package com.xinqi.modules.sys.gpt.manager.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.impl.BaseServiceImpl;
import com.xinqi.modules.sys.gpt.domain.ShareLogEntity;
import com.xinqi.modules.sys.gpt.dto.req.ShareLogQueryDTO;
import com.xinqi.modules.sys.gpt.dto.rsp.ShareLogResultDTO;
import com.xinqi.modules.sys.gpt.manager.ShareLogManager;
import com.xinqi.modules.sys.gpt.mapper.ShareLogMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * 用户分享注册记录管理层实现
 *
 * @author: yyzhen
 * @date: 2023/05/23
 */
@Service
@RequiredArgsConstructor
public class ShareLogManagerImpl extends BaseServiceImpl<ShareLogMapper, ShareLogEntity> implements ShareLogManager {

    /**
     * 分页查询
     *
     * @param page
     * @param query
     * @return
     */
    @Override
    public Page<ShareLogResultDTO> findPage(Page<Object> page, ShareLogQueryDTO query) {
        return this.baseMapper.findPage(page, query);
    }

    /**
     * 获取某天用户的邀请数量
     *
     * @param userId
     * @param day
     * @return
     */
    @Override
    public int countByDay(Long userId, LocalDateTime day) {
        return this.baseMapper.countByDay(userId, day);
    }
}
